<template>
  <!-- 头部部分 -->
  <header class="header">
    <h1>todos</h1>
    <input
      class="new-todo"
      placeholder="请输入任务名称"
      autofocus
      @keydown.enter="todoAdd(todoname)"
      v-model.trim="todoname"
    />
  </header>
</template>

<script>
export default {
  name: 'TdHerder',
  components: {},
  props: {},
  data() {
    return {
      todoname: '',
    }
  },
  methods: {
    todoAdd(todoname) {
      if (todoname === '') return
      this.$emit('todoAdd', todoname)
      this.todoname = ''
    },
  },
}
</script>

<style scoped></style>
